#ifndef INSTEMPCONTEXT_H
#define INSTEMPCONTEXT_H

#include <WinSock2.h>
#include <string>
#include "HttpResponseHeader.h"

class InsTempContext
{
public:
	InsTempContext();

	~InsTempContext();

	SOCKET TempSock()
	{
		return m_tempSock;
	}

	void SetTempSock(SOCKET sock)
	{
		m_tempSock=sock;
	}

	WSABUF* TempBuffer()
	{
		return &m_tempBuffer;
	}

	OVERLAPPED* TempOVL()
	{
		return &m_tempOvl;
	}

	WSABUF* TempWeakRefBuffer()
	{
		return &m_tempWeakRefBuf;;
	}

	std::string& TempRequestBuffer()
	{
		return *m_tempRequestBuffer;
	}

	void SetTempRequestBuffer(std::string *value)
	{
		m_tempRequestBuffer=value;
	}

	void FreeTempRequestBuffer();

	std::string::size_type PartialTransIndex()
	{
		return m_partialTransIndex;
	}

	void SetPartialTransIndex(std::string::size_type index)
	{
		m_partialTransIndex=index;
	}

	HttpResponseHeader& TempHttpResponseHeader()
	{
		return *m_tempHttpResponseHeader;
	}

	void SetTempHttpResponseHeader(HttpResponseHeader *value)
	{
		m_tempHttpResponseHeader=value;
	}

private:
	void InitAsyncParam(OVERLAPPED *ovl,WSABUF *buffer);

	SOCKET m_tempSock;

	OVERLAPPED m_tempOvl;

	WSABUF m_tempBuffer;

	WSABUF m_tempWeakRefBuf;

	std::string *m_tempRequestBuffer;

	std::string::size_type m_partialTransIndex;

	HttpResponseHeader *m_tempHttpResponseHeader;
};

#endif